﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl< ScrumTime.Models.Story >" %>

<script>

    $(function () {
        $("#div_show_story_accordion").accordion({
            autoHeight: false,
            navigation: true
        });
    
        $("#dialog-show-help:ui-dialog").dialog("destroy");

        $("#dialog-show-help").dialog({
            modal: true,
            autoOpen: false,
            height: 650,
            width: 1000,
            buttons: {
                "Close": function () {
                    $(this).dialog("close");
                }
            },
            close: function () {                
                $('#div-show-help-content').html('');                
            }
        });
    });

    function mostrarAyuda(id,helpid, type) {
        $("#dialog-show-help").dialog("open");
        var url = addURLRamdon('/Story/ShowStoryHelp');
        $.post(url,
                {
                    id: id,
                    type: type,
                    HelpId: helpid
                },
                function (data) {
                    if (verificarError(data)) return;
                    $('#div-show-help-content').html(data);
                }
        );
    };

    $("#div_show_story_accordion").accordion({ active: 0 });

    $("#ui-dialog-title-dialog-show-story").text('Story Id/Name: <%:Model.UserDefinedId%>');

</script>


<script runat="server" type="text/C#">
    private Boolean haveUsabilityStories( ScrumTime.Models.Story story ) {
        return (story.Stories1.Count > 0);
    }
        

</script>

<div id="dialog-show-help" title="help">
        <div id="div-show-help-content"></div>
</div>


<div id="div_main_show_story" name="div_main_show_story" style="height:100%;padding:0px;">
    <div id="div_show_story_accordion" style="padding:0px;">
        <h3>Basic Data</h3>
        <div style="width:100%;padding:0px;">
           <% Html.RenderPartial("~/Views/Story/ShowStory_BasicData.ascx", Model); %>    
        </div>
        <h3>Tasks</h3>
        <div id="div_main_show_story_taskList" style="width:100%; padding:0px;">            
           <% Html.RenderPartial("~/Views/Story/ShowStory_Tasks.ascx", Model); %> 
        </div>
        <h3>Acceptance Criteria</h3>
        <div id="div_main_show_story_AcceptanceCriteriaList" style="width:100%; padding:0px;">
            <% Html.RenderPartial("~/Views/Story/ShowStory_AcceptanceCriterias.ascx", Model); %> 
        </div>
        
        <%--solo veremos el tab de usability story solo si la story las tiene.--%>
        <% if (haveUsabilityStories(Model)) { 
           %>
            <h3>Related Stories</h3>
            <div id="div_main_show_story_RelatedStory" style="width:100%; padding:0px;">
                <% Html.RenderPartial("~/Views/Story/ShowUsabilityStory.ascx", Model); %> 
            </div>           
           <%
           }
        %>
    </div>
</div>